<!DOCTYPE html>
<!--[if IE 8]>
<html class="ie ie8"> <![endif]-->
<!--[if IE 9]>
<html class="ie ie9"> <![endif]-->
<!--[if gt IE 9]><!-->
<html> <!--<![endif]-->
<head>
    <meta charset="utf-8">
    <title>千缘婚恋网</title>
    <meta name="description" content="为单身人士找到合适的另一半,交友,约会,相亲为主题的网站">
    <!-- Mobile Metas -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Library CSS -->
    <link rel="stylesheet" href="/static/index/css/bootstrap.css">
    <link rel="stylesheet" href="/static/index/css/fonts/font-awesome/css/font-awesome.css">
    <link rel="stylesheet" href="/static/index/css/animations.css" media="screen">
    <link rel="stylesheet" href="/static/index/css/superfish.css" media="screen">
    <link rel="stylesheet" href="/static/index/css/revolution-slider/css/settings.css" media="screen">
    <link rel="stylesheet" href="/static/index/css/prettyPhoto.css" media="screen">
    <!-- Theme CSS -->
    <link rel="stylesheet" href="/static/index/css/style.css">
    <!-- Skin -->
    <link rel="stylesheet" href="/static/index/css/colors/blue.css">
    <!-- Responsive CSS -->
    <link rel="stylesheet" href="/static/index/css/theme-responsive.css">
    <!-- Switcher CSS -->
    <link href="/static/index/css/switcher.css" rel="stylesheet">
    <link href="/static/index/css/spectrum.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/static/admin/css/boxImg.css">

    <link href="/static/index/css/spectrum.css" rel="stylesheet">

    {{css href="/static/admin/css/toastr.min.css"}}

    <!-- Favicons -->
    <link rel="shortcut icon" href="/static/index/img/ico/favicon.ico">
    <link rel="apple-touch-icon" href="/static/index/img/ico/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="72x72" href="/static/index/img/ico/apple-touch-icon-72.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/static/index/img/ico/apple-touch-icon-114.png">
    <link rel="apple-touch-icon" sizes="144x144" href="/static/index/img/ico/apple-touch-icon-144.png">
    {{block name="mycss"}}
    {{/block}}

    <!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="/static/index/js/respond.min.js"></script>
    <![endif]-->
    <!--[if IE]>
    <link rel="stylesheet" href="/static/index/css/ie.css">
    <![endif]-->

</head>

<body class="home">
<div class="wrap">
    <!-- Header Start -->
    <header id="header">
        <!-- Main Header Start -->
        <div class="main-header">
            <div class="container">
                <!-- TopNav Start -->
                <div class="topnav navbar-header">
                    <a class="navbar-toggle down-button" data-toggle="collapse" data-target=".slidedown">
                        <i class="icon-angle-down icon-current"></i>
                    </a>
                </div>
                <!-- TopNav End -->
                <!-- Logo Start -->
                <div class="logo pull-left">
                    <h1>

                        <a href="{{:url('index/index/index')}}">

                            <img src="/favicon.ico" alt="pixma" width="70" height="70">
                        </a>
                    </h1>
                </div>
                <!-- Logo End -->

                <!-- Menu Start -->
                <nav class="collapse navbar-collapse menu">
                    <ul class="nav navbar-nav sf-menu">

                        <li><a href="{{:url('index/index/index')}}"> 我的缘分</a></li>
                        <!--<li><a href="{{:url('index/search/index')}}" class="sf-with-ul">缘分搜索</a></li>-->
                        <li><a href="{{:url('index/search/index')}}" class="sf-with-ul">缘分搜索</a></li>

                        <li><a href="{{:url('index/diary/index')}}" class="sf-with-ul">爱情日记</a></li>
                        <li><a href="#">个人中心</a></li>
                        {{empty name="list['name']"}}
                        <li><a class="demo5">登录</a></li>
                        <li><a class="demo6">注册</a></li>
                        {{else /}}
                        <li><a class="#" data-id="{{$list['id']}}">{{$list['name']}}</a></li>
                        <li><a href="{{:url('index/login/cancellation')}}">注销</a></li>
                        {{/empty}}
                    </ul>
                </nav>
                <!-- Menu End -->
            </div>
        </div>
        <!-- Main Header End -->
    </header>
    <!-- Header End -->


    {{block name="main"}}

    <!-- Content Start -->
    <div id="main">
        <!-- Slider Start-->
        <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
            <!-- Indicators -->
            <ol class="carousel-indicators">
                <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
                <li data-target="#carousel-example-generic" data-slide-to="1"></li>
                <li data-target="#carousel-example-generic" data-slide-to="2"></li>
            </ol>

            <!-- Wrapper for slides -->
            <div class="carousel-inner" role="listbox">
                <div class="item active row">

                    <div class="col-md-1 col-md-offset-1"></div>
                    {{volist name="list['data']" id="v" }}
                    <div class="col-md-1">
                        <a href="#" class="thumbnail">
                            <img src="{{$v['icon']}}" style="height:90px">

                        </a>
                    </div>
                    {{/volist}}
                </div>

                <div class="item">

                    <div class="col-md-1 col-md-offset-1"></div>
                    {{volist name="list['data']" id="v" }}
                    <div class="col-md-1">
                        <a href="#" class="thumbnail">
                            <img src="{{$v['icon']}}" style="height:90px">

                        </a>
                    </div>
                    {{/volist}}
                </div>
            </div>

            <!-- Controls -->
            <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
                <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                <span class="sr-only">Previous</span>
            </a>
            <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
                <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                <span class="sr-only">Next</span>
            </a>
        </div>
        <!-- Slider End-->


        <!-- Slogan Start-->
        <div class="slogan bottom-pad-small">
            <div class="content">
                <div class="container">
                    <div class="row team-members">
                        <div class="posts-block col-lg-9 col-md-9 col-sm-8 col-xs-12">


                            <div class="row" id="userDisplay">
                                {{volist name="list['data']" id="v" }}
                                <div class="single-member effect-1 col-md-5">
                                    <div class="col-md-5">
                                        <div class="member-image">

                                            <img src={{$v.icon}} alt="Member" style="height:120px" modal="zoomImg">
                                        </div>
                                    </div>
                                    <div class="col-md-7">
                                        <div class="member-info">
                                            <div class="row">
                                                <h3>{{$v.nickname}}</h3>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-6">正在寻找:</div>
                                                <div class="col-md-6">
                                                    <small>上海</small>
                                                    <small>男士</small>
                                                    <small>26-35岁</small>
                                                    <small>未婚的男士</small>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-4">生日:</div>
                                                <div class="lead ">{{$v.birthday}}</div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="social-touch">
                                        <a class="icon-trophy icon-2x" href="#"></a>
                                        <a class="icon-envelope icon-2x" href="#"></a>
                                        <a class="icon-comment icon-2x" href="#"></a>
                                    </div>
                                </div>
                                {{/volist}}

                            </div>
                            <div class="blog-divider"></div>
                        </div>


                        <div class="sidebar col-lg-3 col-md-3 col-sm-4 col-xs-12">
                            <!-- Personal -->
                            <div class="row">
                                <div id="horizontal-tabs">
                                    <div class="contents">
                                        <div class="tabscontent" id="content1" style="display: block;">
                                            <ul class="posts">
                                                <li class="row">
                                                    <img class="col-md-5 img-thumbnail recent-post-img"
                                                         src="/static/index/img/recent-post-img.jpg">
                                                    <div class="col-md-5"><h4>老王</h4></div>
                                                </li>
                                                <li class="row text-center">
                                                    <a href="#">查看资料</a>
                                                </li>
                                                <li class="row">
                                                <span class="col-md-6">
                                                    上次登录时间
                                                </span>
                                                    <span class="color">2018-04-04</span>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>

                                    <ul class="row tabs">
                                        <li class="col-md-4">上传图片</li>
                                        <li class="col-md-4">完善信息</li>
                                        <li class="col-md-4">缘分币</li>
                                    </ul>
                                </div>
                            </div>


                            <!-- End Personal -->

                            <!-- Who has seen me -->
                            <div class="widget ads">
                                <h3 class="title">谁看过我</h3>
                                <div class="ads-img row">
                                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
                                        <img class="thumbnail col-md-12" alt="" src="static/index/img/meinv.jpg">
                                        <span class="text-center col-md-12">马蓉</span>
                                    </div>
                                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
                                        <img class="thumbnail col-md-12" alt="" src="/static/index/img/meinv.jpg">
                                        <span class="text-center col-md-12">李小璐</span>
                                    </div>
                                </div>
                                <div class="ads-img row">
                                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
                                        <img class="thumbnail col-md-12" alt="" src="static/index/img/meinv.jpg">
                                        <span class="text-center col-md-12">马蓉</span>
                                    </div>
                                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
                                        <img class="thumbnail col-md-12" alt="" src="/static/index/img/meinv.jpg">
                                        <span class="text-center col-md-12">李小璐</span>
                                    </div>
                                </div>
                            </div>
                            <!-- end Who has seen me -->
                        </div>
                        <!-- Sidebar End -->
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- Content End -->

    <!-- end main -->
    {{/block}}


    <!-- Footer Start -->
    <footer id="footer">
        <!-- Footer Top Start -->
        <!--<div class="footer-top">-->
        <div class="container">
            <div class="row">
                <div class="col-md-1">
                    <mark>城市征婚:</mark>
                </div>
                <div class="col-md-10">
                    <div class="col-md-1">北京</div>
                    <div class="col-md-1">上海</div>
                    <div class="col-md-1">广州</div>
                    <div class="col-md-1">深圳</div>
                    <div class="col-md-1">重庆</div>
                    <div class="col-md-1">杭州</div>
                    <div class="col-md-1">南京</div>
                    <div class="col-md-1">苏州</div>
                    <div class="col-md-1">天津</div>
                    <div class="col-md-1">宁波</div>
                    <div class="col-md-1">昆明</div>
                    <div class="col-md-1">长沙</div>
                </div>
                <div class="col-md-1"><a href="#">[更多城市]</a></div>
            </div>
            <div class="row">
                <div class="col-md-10 col-md-offset-1">
                    <a href="#">
                        <div class="col-md-1">
                            <small>关于我们</small>
                        </div>
                    </a>
                    <a href="#">
                        <div class="col-md-1">
                            <small>联系我们</small>
                        </div>
                    </a>
                    <a href="#">
                        <div class="col-md-1">
                            <small>加入我们</small>
                        </div>
                    </a>
                    <a href="#">
                        <div class="col-md-1">
                            <small>合作伙伴</small>
                        </div>
                    </a>
                    <a href="#">
                        <div class="col-md-1">
                            <small>意见反馈</small>
                        </div>
                    </a>
                    <a href="#">
                        <div class="col-md-1">
                            <small>网址地图</small>
                        </div>
                    </a>
                    <a href="#">
                        <div class="col-md-1">
                            <small>帮助中心</small>
                        </div>
                    </a>
                    <a href="#">
                        <div class="col-md-1">
                            <small>缘分会员</small>
                        </div>
                    </a>
                    <a href="#">
                        <div class="col-md-1">
                            <small>缘分相亲</small>
                        </div>
                    </a>
                    <a href="#">
                        <div class="col-md-1">
                            <small>服务协议</small>
                        </div>
                    </a>
                    <a href="#">
                        <div class="col-md-1">
                            <small>信息保护</small>
                        </div>
                    </a>
                </div>
            </div>
            <div class="footer-top">
                <div class="row">
                    <div class="col-md-offset-2">
                        <div class="col-md-3 ">
                            <span style="color:green"><i class="icon-thumbs-up icon-3x "></i></span>
                            <span>百佳交友网站</span>
                        </div>
                        <div class="col-md-3">
                            <span style="color: red;"><i class="icon-heart icon-3x "></i></span>
                            <span>用心保证</span>
                        </div>
                        <div class="col-md-3">
                            <span><i class="icon-home icon-3x"></i></span>
                            <span>家的温暖</span>
                        </div>
                        <div class="col-md-3">
                            <span><i class="icon-plus icon-3x"></i></span>
                            <span>敬请期待</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--</div>-->
        <!-- Footer Top End -->
    </footer>
    <!-- Scroll To Top -->
    <a href="#" class="scrollup"><i class="icon-angle-up"></i></a>
</div>
<!-- Wrap End -->


{{block name="mymodal"}}

<section id="style-switcher">
    <!-- LOGINMODAL -->
    <div id="demoModal1" class="block modal2 container">
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
        <form id="mylogin">
            <div class="row">
                <div class="col-md-10 col-md-offset-1 form_control">
                    <input class="required col-md-12 tel" type="text" name="tel" placeholder="输入手机号"
                           data-valid="isNonEmpty||isMobile" data-error="* 手机号不能为空||* 手机格式不正确" maxlength="11">
                </div>
            </div>
            <br>

            <div class="row ">
                <div class="col-md-10 col-md-offset-1 form_control">
                    <input class="required col-md-12 pass" type="password" name="pass" placeholder="请输入密码"
                           data-valid="isNonEmpty||between:6-16" data-error="* 密码不能为空||* 密码长度6-16位">
                </div>
            </div>
            <br>
            <div class="row ">
                <div class="form_control input-group col-md-4 col-md-offset-1">
                    <label>
                        <input type="checkbox" name="remember" value="1" checked>
                        <small>下次自动登录</small>
                    </label>
                </div>
            </div>

            <div class="row">
                <div id="embed-captcha" class="col-md-offset-1"></div>
                <p id="wait" class="show">正在加载验证码......</p>
            </div>

            <div class="row">
                <div class="col-md-offset-4">
                    <p id="notice" class="hide col-md-offset-2">请先完成验证</p>
                </div>
            </div>

            <div class="row">
                <button type="button" class="btn btn-primary btn-lg col-md-10 col-md-offset-1 login" id="embed-submit">
                    登录
                </button>
            </div>

            <div class="row ">
                <div class="checkbox input-group col-md-8 col-md-offset-2">
                    <a href="#">忘记密码?</a>
                    <a class="col-md-offset-6 demo6">去注册</a>
                </div>
            </div>
        </form>
    </div>
    <!-- end LOGINMODAL -->

    <!-- adduser -->
    <div id="demoModal2" class="block2 modal3 container">
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
        <form id="myRegister">

            <div class="row ">
                <div class="text-center col-md-3">你是:</div>
                <div class="col-md-4">
                    <label>
                        <input type="radio" name="sex" value="1" checked>
                        <i class="icon-male icon-2x" style="background:skyblue"></i>男
                    </label>
                </div>
                <div class="col-md-4">
                    <label>
                        <input type="radio" name="sex" value="2">
                        <i class="icon-female icon-2x" style="background:pink"></i>女
                    </label>
                </div>
            </div>
            <div class="row">
                <div class="text-center col-md-3">手机号码:</div>
                <div class="col-md-8 form_control">
                    <input type="text" class="form-control required" name="tel" placeholder="请输入手机号" maxlength="11"
                           data-valid="isNonEmpty||isMobile" data-error="* 手机号不能为空||* 手机格式不正确" id="tel">
                </div>
            </div>
            <br>
            <div class="row">
                <div class="text-center col-md-3">昵称:</div>
                <div class="col-md-8 form_control">
                    <input type="text" class="form-control required" name="nickname" placeholder="输入昵称"
                           data-valid="isNonEmpty" data-error="* 昵称不能为空">
                </div>
            </div>
            <br>

            <div class="row">
                <div class="text-center col-md-3">城市:</div>
                <div data-toggle="distpicker" class="col-md-8">
                    <select class="col-md-4" id="province1" name="province"  onmousedown="if(this.options.length>6){this.size=7}" onblur="this.size=0" onchange="this.size=0"></select>
                    <select class="col-md-4" id="city1" name="city" onmousedown="if(this.options.length>6){this.size=7}" onblur="this.size=0" onchange="this.size=0"></select>
                    <select class="col-md-4" id="district1" name="area" onmousedown="if(this.options.length>6){this.size=7}" onblur="this.size=0" onchange="this.size=0"></select>
                </div>
            </div>
            <br>

            <div class="row ">
                <div class="text-center col-md-3">密码:</div>
                <div class="col-md-8 form_control">
                    <input type="password" class="form-control required" name="pass" placeholder="请输入密码"
                           data-valid="isNonEmpty||between:6-16" data-error="* 密码不能为空||* 密码长度6-16位" id="password">
                </div>
            </div>
            <br>
            <div class="row ">
                <div class="text-center col-md-3">确认密码:</div>
                <div class="col-md-8 form_control">
                    <input type="password" class="form-control required" name="repass" placeholder="确认密码"
                           data-valid="isNonEmpty||between:6-16" data-error="* 密码不能为空||* 密码长度6-16位" id="repassword">
                </div>
            </div>
            <br>
            <div class="row ">
                <div class="text-center col-md-3">验证码:</div>
                <div class="col-md-4 form_control">
                    <input type="text" name="verification" class="required" placeholder="验证码" maxlength="6"
                           data-valid="between:6-6" data-error="* 验证码长度不对" style="padding-left:10px;" id="yzm">
                </div>
                <div class="col-md-5">
                    <button class="btn btn-small btn-primary col-md-offset-1" type="button" id="getyzm">获取短信验证码</button>
                </div>
            </div>
            <br>

            <div class="row">
                <button type="button" class="btn btn-primary btn-lg col-md-10 col-md-offset-1" id="Register" disabled>
                    请先获取验证码
                </button>
            </div>
        </form>
    </div>
    <!-- end adduser -->
</section>
{{/block}}


<!-- The Scripts -->
<script src="/static/index/js/jquery.min.js"></script>
<script src="/static/index/js/bootstrap.js"></script>
<script src="/static/index/js/jquery.parallax.js"></script>
<script src="/static/index/js/modernizr-2.6.2.min.js"></script>
<script src="/static/index/js/revolution-slider/js/jquery.themepunch.revolution.min.js"></script>
<script src="/static/index/js/jquery.nivo.slider.pack.js"></script>
<script src="/static/index/js/jquery.prettyPhoto.js"></script>
<script src="/static/index/js/superfish.js"></script>
<script src="/static/index/js/tweetMachine.js"></script>
<script src="/static/index/js/jquery.gmap.min.js"></script>
<script src="/static/index/js/circularnav.js"></script>
<script src="/static/index/js/jquery.sticky.js"></script>
<script src="/static/index/js/jflickrfeed.js"></script>
<script src="/static/index/js/imagesloaded.pkgd.min.js"></script>
<script src="/static/index/js/waypoints.min.js"></script>
<script src="/static/index/js/spectrum.js"></script>
<script src="/static/index/js/switcher.js"></script>
<script src="/static/admin/js/boxImg.js" type="text/javascript"></script>


<!-- 引入模态框 -->
<script src="/static/index/js/Sweefty.js"></script>
<script src="/static/index/js/moaModal.minified.js"></script>
<!-- 引入jquery验证方法 -->
<script src="/static/index/js/jquery-validate.js"></script>
<!--极验验证-->
<script src="/static/admin/js/gt.js"></script>
<!-- 下拉三级联动地地址-->
<script src="/static/index/js/distpicker.data.js"></script>
<script src="/static/index/js/distpicker.js"></script>
<script src="/static/index/js/main.js"></script>
<!--引入toastr提示-->
{{js href="/static/admin/js/toastr.min.js"}}

<!--引入toastr提示-->
{{js href="/static/admin/js/toastr.min.js"}}

{{block name="myjs"}}
<script>
    // 极验验证
    var handlerEmbed = function (captchaObj) {
        $("#embed-submit").click(function (e) {
            validate = captchaObj.getValidate();
            if (!validate) {
                $("#notice")[0].style.color = "red";
                $("#notice")[0].className = "show";

                setTimeout(function () {
                    $("#notice")[0].className = "hide";
                }, 2000);
                e.preventDefault();
            }

            var res = $('#mylogin').validate('submitValidate'); //return boolean;

            if (res && validate) {
                var info = $('#mylogin input').serialize();
                loginAjax(info);
            } else {
                e.preventDefault();
            }
        });

        // 将验证码加到id为captcha的元素里，同时会有三个input的值：geetest_challenge, geetest_validate, geetest_seccode
        captchaObj.appendTo("#embed-captcha");
        captchaObj.onReady(function () {
            $("#wait")[0].className = "hide";
        });
        // 更多接口参考：http://www.geetest.com/install/sections/idx-client-sdk.html
    };

    $.ajax({
        // 获取id，challenge，success（是否启用failback）
        url: "/req/" + (new Date()).getTime(), // 加随机数防止缓存
        type: "get",
        dataType: "json",
        success: function (data) {
            data = JSON.parse(data);
            // 使用initGeetest接口
            // 参数1：配置参数
            // 参数2：回调，回调的第一个参数验证码对象，之后可以使用它做appendTo之类的事件
            initGeetest({
                gt: data.gt,
                challenge: data.challenge,
                new_captcha: data.new_captcha,
                product: "float", // 产品形式，包括：float，embed，popup。注意只对PC版验证码有效
                offline: !data.success // 表示用户后台检测极验服务器是否宕机，一般不需要关注
            }, handlerEmbed);
        }
    });

    // 登录模态框
    $(document).ready(function () {
        $(document).modal({});

        $('.demo5').modal({
            target: '#demoModal1',
            speed: 200,
            easing: 'easeInOutExpo',
            animation: 'top height',
            position: '8% auto',
            overlayClose: true,
            on: 'click',
        });

        // 注册模态
        $('.demo6').modal({
            target: '#demoModal2',
            speed: 200,
            easing: 'easeOutBack',
            animation: 'right',
//            position: 'center',
            position: '0 auto',
            overlayClose: true,
            on: 'click'
        });
    });


    //登录信息验证
    $('#mylogin').validate({
        onFocus: function () {
            this.parent().addClass('active');
            return false;
        },
        onBlur: function () {
            var $parent = this.parent();
            var _status = parseInt(this.attr('data-status'));
            $parent.removeClass('active');
            if (!_status) {
                $parent.addClass('error');
            }
            return false;
        }
    });

    // 登录ajax请求
    function loginAjax(arr) {
        $.ajax({
            type: 'post',
            url: '/indexLogin/',
            data: arr,
            dataType: 'json',
            success: function (data) {
                if (data.status) {
                    toastr.success(data.msg);
                    window.location.reload();
                } else {
//                    alert(data.msg);
                    toastr.error(data.msg);
                }
            },
            error: function () {
                alert('AJAX请求错误!!');
            }
        });
    }

    // 注册用户验证
    $('#myRegister').validate({
        onFocus: function () {
            this.parent().addClass('active');
            return false;
        },
        onBlur: function () {
            var $parent = this.parent();
            var _status = parseInt(this.attr('data-status'));
            $parent.removeClass('active');
            if (!_status) {
                $parent.addClass('error');
            }
            return false;
        }
    });

    // 注册
    $('#Register').on('click', function (event) {
        event.preventDefault();
        var yzm = $('#yzm').val();
        if (yzm != '' && (yzm.length == 6)) {
            var res = $('#myRegister').validate('submitValidate'); //return boolean;
        } else {
            toastr.error('请先获取验证码');
        }

        var res = $('#myRegister').validate('submitValidate'); //return boolean;

        if (res) {
            var pwd = $('#password').val();
            var repwd = $('#repassword').val();
            if(pwd != repwd){
                toastr.error('两次密码不一致');
                return;
            }

            var str = $('#myRegister').serialize();

            // 注册信息ajax请求
            registerAjax(str);
        } else {
            event.preventDefault();
        }
    });

    // 注册ajax
    function registerAjax(res) {
        $.ajax({
            type: 'post',
            url: '/register/',
            data: res,
            dataType: 'json',
            success: function (data){
                if(data.status){
                    toastr.success(data.msg);
                    window.location.reload();
                }else{
                    toastr.error(data.msg);
                }
            },
            error: function (){
                alert('ajax请求错误');
            }
        });
    }

    // 验证码框失焦检验
    $('#yzm').blur(function () {
        var yzm = $('#yzm').val();
        if (yzm != '' && (yzm.length == 6)) {
            $('#Register').attr('disabled', false);
            $('#Register').html('确认提交');
        } else {
            $('#Register').attr('disabled', true);
            $('#Register').html('请先填写验证码');
        }
    });

    // 验证码框松开按键检验
    $('#yzm').keyup(function () {
        var yzm = $('#yzm').val();
        if (yzm != '' && (yzm.length == 6)) {
            $('#Register').attr('disabled', false);
            $('#Register').html('确认提交');
        } else {
            $('#Register').attr('disabled', true);
            $('#Register').html('请先填写验证码');
        }
    });

    // 获取验证码
    $('#getyzm').click(function () {
        var tel = $('#tel').val();

        if (tel == '' || tel.match(/^[1][3,4,5,7,8][0-9]{9}$/) == null) {
            toastr.error('请填写正确的手机号码');
        } else {
            var test = {'tel': tel};
            // 验证手机号是否存在
            valiTel(test);
        }
    });

    // 手机号验证是否存在
    function valiTel(tel) {
        $.ajax({
            type: 'post',
            url: '/tel/',
            data: tel,
            dataType: 'json',
            success: function (data){
                if(data.status){
                    $('#getyzm').attr('disabled', true);
                    $('#Register').attr('disabled', false);
                    $('#Register').html('确认提交');
                    time();
                    smsAjax(tel);
                } else {
                    toastr.error('手机号已经存在');
                }
            },
            error: function (){
                alert('ajax请求错误');
            }
        });
    }

    // 1分钟定时器
    var m = 60;
    function time() {
        $('#getyzm').html(m + '秒后重新获取');
        m--;
        if (m < 0) {
            $('#getyzm').html('获取短信验证码');
            $('#getyzm').attr('disabled', false);
            clearTimeout(one);
            return (m = 60);
        }
        var one = setTimeout(time, 100);
    }

    // 容联云短信请求
    function smsAjax(tel) {
        console.log(tel);
        $.ajax({
            type: 'post',
            url: '/reg/',
            data: tel,
            dataType: 'json',
            success: function (data) {
                console.log(data);
                if (data.status) {
                    toastr.success('短信验证码发送成功');
                } else {
                    toastr.error('短信验证码发送失败');
                }
            },
            error: function () {
                alert('AJAX请求错误!!');
            }
        });
    }


    // 图片放大处理
    $(function () {
        var x = 10;
        var y = 20;
        $("a.tooltip").mouseover(function (e) {

            var tooltip = "<div id='tooltip'><img src='" + this.href + "' alt='产品预览图'/><\/div>"; //创建 div 元素
            $("body").append(tooltip);	//把它追加到文档中
            $("#tooltip")
                .css({
                    "top": (e.pageY + y) + "px",
                    "left": (e.pageX + x) + "px"
                }).show("fast");	  //设置x坐标和y坐标，并且显示
        }).mouseout(function () {

            $("#tooltip").remove();	 //移除
        }).mousemove(function (e) {
            $("#tooltip")
                .css({
                    "top": (e.pageY + y) + "px",
                    "left": (e.pageX + x) + "px"
                });
        });
    });

</script>

{{/block}}


</body>
</html>